# 封装函数获取登录成功后的令牌并组织橙请求头返回
import requests


def get_header():
    # 发送登录
    resp = requests.post(url="http://ihrm2-test.itheima.net/api/sys/login",
                         json={"mobile": "13800000002", "password": "123456"})
    # 获取响应结果
    token = resp.json().get("data")

    # 组织请求头，返回
    return {"Authorization": token}


if __name__ == '__main__':
    ret = get_header()
    print(ret)
